qemu: Use domid in qemu log name. Can be related back to domain name
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 5 Jun 2007 08:59:34 +0000 (09:59 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 5 Jun 2007 08:59:34 +0000 (09:59 +0100)
or uuid via xend logs, less unique than pids to prevent excessive
number of log files hanging around, yet not immediately reused (unlike
e.g., after domain crash or reboot) where previous log file is
immediately overwritten. Not using domain names in logs avoids and
chance of unprintable charcatres becoming embedded in filenames.
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/ioemu/vl.c

index 7de0d86da1d1a78cc78cc2165b38a99f59b1fc9e..5458684f3e59080a2546ebb88bcada009fbfa452 100644 (file)
@@ -183,7 +183,7 @@ extern int vcpus;
 
 int xc_handle;
 
-char domain_name[64] = "Xen HVM Guest";
+char domain_name[64] = "Xen-HVM-no-name";
 extern int domid;
 
 char vncpasswd[64];
@@ -7525,8 +7525,8 @@ int main(int argc, char **argv)
                 semihosting_enabled = 1;
                 break;
             case QEMU_OPTION_domainname:
-                strncpy(domain_name, optarg, sizeof(domain_name));
-                domain_name[sizeof(domain_name)-1] = '\0';
+                snprintf(domain_name, sizeof(domain_name),
+                         "Xen-HVM-%s", optarg);
                 break;
             case QEMU_OPTION_d:
                 domid = atoi(optarg);
@@ -7550,7 +7550,7 @@ int main(int argc, char **argv)
     }
 
     /* Now send logs to our named config */
-    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm-%s.log", domain_name);
+    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm-%d.log", domid);
     cpu_set_log_filename(qemu_dm_logfilename);
 
 #ifndef _WIN32